package com.lepu.app.fun.mother_circle.bean;

import java.io.Serializable;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class BeanMotherCircle implements Serializable{


    /**
	 * 
	 */
	private static final long serialVersionUID = -7687392917902493165L;
	
	public String cricleID;
    public String cricleAvatar;
    public String cricleName;
    public String cricleContent;
    public String cricleRule;
    public String criclePeopleCount;
    public String cricleTopicCount;
    
    public int cricleType; //0为未加入圈子,1为已加入
    public int cricleTypeInterest; //可能感兴趣的圈子 0 / 1
    
    public String ParentTCID;
    public String ParentTCTitle;
    
    public static ArrayList<BeanMotherCircle> parseJsonData(String dataString) {
    	ArrayList<BeanMotherCircle> circleList = new ArrayList<BeanMotherCircle>();
        try {
        	
            JSONObject jsonObject = new JSONObject(dataString);
            JSONObject obj1 = (JSONObject) jsonObject.get("Result");
            JSONArray dataArray = obj1.getJSONArray("ListInfo");
            
            for(int i=0; i<dataArray.length(); i++){
					JSONObject focusJson = (JSONObject) dataArray.get(i);
					BeanMotherCircle motherCircle = new BeanMotherCircle();
					motherCircle.cricleID = focusJson.optString("CategoryID");
					motherCircle.cricleAvatar = focusJson.optString("Logo");
					motherCircle.cricleName = focusJson.optString("CategoryTitle");
					motherCircle.cricleContent = focusJson.optString("Resume");
					motherCircle.cricleRule = focusJson.optString("Rule");
					motherCircle.criclePeopleCount = focusJson.optString("MemberCount");
					motherCircle.cricleTopicCount = focusJson.optString("TopicCount");
					motherCircle.cricleType = focusJson.optInt("IsJoined");
					motherCircle.cricleTypeInterest = focusJson.optInt("IsRecommend");
					motherCircle.ParentTCID = focusJson.optString("ParentTCID");
					motherCircle.ParentTCTitle = focusJson.optString("ParentTCTitle");
					circleList.add(motherCircle);
				}

        } catch (JSONException e) {
            e.printStackTrace();
        }
 
        return circleList;
    }

    public static ArrayList<BeanMotherCircle> getTestDataType1(){
    	ArrayList<BeanMotherCircle>  list = new ArrayList<BeanMotherCircle>();
    	
    	BeanMotherCircle bean1 = new BeanMotherCircle();
    	bean1.cricleName = "你问我答";
    	bean1.criclePeopleCount = "317";
    	bean1.cricleTopicCount = "926";
    	bean1.cricleType = 1;
    	BeanMotherCircle bean2 = new BeanMotherCircle();
    	bean2.cricleName = "宝妈一起秀";
    	bean2.criclePeopleCount = "317";
    	bean2.cricleTopicCount = "926";
    	bean2.cricleType = 1;
    	BeanMotherCircle bean3 = new BeanMotherCircle();
    	bean3.cricleName = "家庭情感";
    	bean3.criclePeopleCount = "317";
    	bean3.cricleTopicCount = "926";
    	bean3.cricleType = 1;
    	
    	list.add(bean1);
    	list.add(bean2);
    	list.add(bean3);
    	
        return list;
    }
    
    public static ArrayList<BeanMotherCircle> getTestDataType0(){
    	ArrayList<BeanMotherCircle>  list = new ArrayList<BeanMotherCircle>();
    	
    	BeanMotherCircle bean1 = new BeanMotherCircle();
    	bean1.cricleName = "月子交流圈";
    	bean1.criclePeopleCount = "317";
    	bean1.cricleTopicCount = "926";
    	bean1.cricleType = 0;
    	BeanMotherCircle bean2 = new BeanMotherCircle();
    	bean2.cricleName = "宝妈谈经验";
    	bean2.criclePeopleCount = "317";
    	bean2.cricleTopicCount = "926";
    	bean2.cricleType = 0;
    	
    	list.add(bean1);
    	list.add(bean2);
    	
        return list;
    }
    
    public static ArrayList<BeanMotherCircle> getTestDataType01(){
    	ArrayList<BeanMotherCircle>  list = new ArrayList<BeanMotherCircle>();
    	
    	BeanMotherCircle bean1 = new BeanMotherCircle();
    	bean1.cricleName = "月子交流圈";
    	bean1.criclePeopleCount = "317";
    	bean1.cricleTopicCount = "926";
    	bean1.cricleType = 0;
    	BeanMotherCircle bean2 = new BeanMotherCircle();
    	bean2.cricleName = "宝妈谈经验";
    	bean2.criclePeopleCount = "317";
    	bean2.cricleTopicCount = "926";
    	bean2.cricleType = 0;
    	BeanMotherCircle bean3 = new BeanMotherCircle();
    	bean3.cricleName = "你问我答";
    	bean3.criclePeopleCount = "317";
    	bean3.cricleTopicCount = "926";
    	bean3.cricleType = 1;
    	BeanMotherCircle bean4 = new BeanMotherCircle();
    	bean4.cricleName = "宝妈一起秀";
    	bean4.criclePeopleCount = "317";
    	bean4.cricleTopicCount = "926";
    	bean4.cricleType = 1;
    	BeanMotherCircle bean5 = new BeanMotherCircle();
    	bean5.cricleName = "家庭情感";
    	bean5.criclePeopleCount = "317";
    	bean5.cricleTopicCount = "926";
    	bean5.cricleType = 1;
    	
    	
    	list.add(bean1);
    	list.add(bean2);
    	list.add(bean3);
    	list.add(bean4);
    	list.add(bean5);
    	
        return list;
    }
    
}
